import { reactive } from "vue"
import {mainStore} from '../store'

interface userInfo{
    avatarUrl:string,
    city:string,
    gender:number,
    language:string,
    nickName:string,
    province:string
}

const store = mainStore()
export const user = reactive<userInfo>({
    avatarUrl:store.$state.userInfo.avatarUrl,
    city:store.$state.userInfo.city,
    gender:store.$state.userInfo.gender,
    language:store.$state.userInfo.language,
    nickName:store.$state.userInfo.nickName,
    province:store.$state.userInfo.province
}) 

export function outUser(){
    store.$state.userInfo.avatarUrl = ''
    store.$state.userInfo.city = ''
    store.$state.userInfo.gender = 0
    store.$state.userInfo.language = ''
    store.$state.userInfo.nickName = ''
    store.$state.userInfo.province = ''

    uni.redirectTo({
        url:'../index/index',
    })
}